package com.crm.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.crm.dao.BizExaminationFeeMapper;
import com.crm.model.BizExaminationFee;
import com.crm.service.BizExaminationFeeService;
import com.crm.util.UUIDUtil;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;

@Service
public class BizExaminationFeeServiceImpl extends BaseServiceImpl<BizExaminationFee> implements BizExaminationFeeService{
	@Autowired
	private BizExaminationFeeMapper bizExaminationFeeMapper;
	
	@Override
	public int insert(BizExaminationFee record) {
		
		List<BizExaminationFee> list = bizExaminationFeeMapper.selectByWhereYz(record);
		if(list.size()>0){
			throw new RuntimeException("该考务费设置已创建！"); 
		}
		String uuid = UUIDUtil.getUUID();
		record.setExaminationFeeId(uuid);
		return super.insert(record);
	}
	//验证数据
	@Override
	public List<BizExaminationFee> selectByWhereYz(Page<BizExaminationFee> page, BizExaminationFee Record) {
		PageHelper.startPage(page.getPageNum(), page.getPageSize(), "sort_code asc");
		List<BizExaminationFee> list = bizExaminationFeeMapper.selectByWhereYz(Record);
		return list;
	}
}
